/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SLE_ANNOUNCE_HDI_H
#define SLE_ANNOUNCE_HDI_H

#include "sle_hal_errcode.h"
#include "sle_announce_config.h"


/**
 * @brief Callback invoked when connect announce enabled.
 *
 * @param [in] announceId announce ID.
 * @param [in] errCode       error code.
 * @return #void no return value.
 */
typedef void (*SleHdiStartAnnounceCallback)(uint32_t announceId, SleHdiErrorCode errCode);

/**
 * @brief Callback invoked when connect announce disabled.
 *
 * @param [in] announceId announce ID.
 * @param [in] errCode       error code.
 * @return #void no return value.
 */
typedef void (*SleHdiStopAnnounceCallback)(uint32_t announceId, SleHdiErrorCode errCode);

/**
 * @brief Callback invoked when announce terminated.
 *
 * @param [in] announceId announce ID.
 * @param [in] errCode       error code.
 * @return #void no return value.
 */
typedef void (*SleHdiTerminalAnnounceCallback)(uint32_t announceId);

typedef void (*SleHdiRemoveAnnounceCallback)(uint32_t announceId, SleHdiErrorCode errCode);
/**
 * @brief Struct of SLE device announce callback function.
 */
typedef struct {
    SleHdiStartAnnounceCallback OnAnnounceStartCb;        /*!< @if Eng device announce enable callback.
                                                                 @else   设备公开使能回调函数。 @endif */
    SleHdiStopAnnounceCallback OnAnnounceStopCb;      /*!< @if Eng device announce disable callback.
                                                                 @else   设备公开关闭回调函数。 @endif */
    SleHdiTerminalAnnounceCallback OnAnnounceTerminalCb;    /*!< @if Eng device announce terminated callback.
                                                                 @else   设备公开停止回调函数。 @endif */
    SleHdiRemoveAnnounceCallback OnAnnounceRemoveCb;    /*!< @if Eng device announce remove callback.
                                                                 @else   设备公开停止回调函数。 @endif */
} SleAnnounceHdiCallbacks;

/**
 * @brief Use this funtion to set announce data.
 *
 * @param  [in] announceId announce ID
 * @param  [in] data         a pointer to the announce data
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiSetAnnounceData)(uint8_t announceId, const SleAnnounceData *data);

/**
 * @brief Use this funtion to set announce parameter.
 *
 * @param  [in] announceId announce ID
 * @param  [in] param        a pointer to the announce parameter
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiSetAnnounceParam)(uint8_t announceId, const SleAnnounceParam *param);

/**
 * @brief Use this funtion to remove announce.
 *
 * @param  [in] announceId announce ID
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiRemoveAnnounce)(uint8_t announceId);

/**
 * @brief Use this funtion to start announce.
 *
 * @param  [in] announceId announce ID
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiStartAnnounce)(uint8_t announceId);

/**
 * @brief Use this funtion to stop announce.
 *
 * @param  [in] announceId announce ID
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiStopAnnounce)(uint8_t announceId);

/**
 * @brief  Register SLE device Announce callbacks.
 *
 * @par Description: Register SLE device Announce callbacks.
 * @param [in] seekCallbacks Callback function.
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiRegisterAnnounceCallbacks)(SleAnnounceHdiCallbacks *announceCallbacks);

/**
 * @brief Struct of announce module function.
 *
 * @else
 * @brief SLE广播模块接口定义。
 */
typedef struct {
    SleHdiStartAnnounce startAnnounce;                   /*!< @if Start announce.
                                                              @else   开始设备广播。 @endif */
    SleHdiStopAnnounce stopAnnounce;                     /*!< @if Stop announce.
                                                              @else   结束设备广播。 @endif */
    SleHdiSetAnnounceData setAnnounceData;             /*!< @if Set announce data.
                                                              @else   设置设备广播数据。 @endif */
    SleHdiSetAnnounceParam setAnnounceParam;           /*!< @if Set announce parameter.
                                                              @else   设置设备广播参数。 @endif */
    SleHdiRegisterAnnounceCallbacks registerAnnounceCbks;      /*!< @if Register announce callbacks.
                                                                            @else   注册设备广播回调函数。 @endif */
} SleAnnounceHdiOpts;

/**
 * @brief  sle_adapter_hdi.SleAnnounceHdiOpts
 *
 * @par    从sdk中获取hdi总接口函数集。
 * @param  [out] announceOpts    sle announce接口函数集。
 * @return SleHdiErrorCode
 *
 * @note   announceOpts不应为NULL，且由调用者管理内存
**/
SleHdiErrorCode GetSleAnnounceHdiOpts(SleAnnounceHdiOpts *announceOpts);

#endif // SLE_ANNOUNCE_HDI_H